﻿#include "decodeBase.h"

#include <crtdbg.h>
#include <assert.h>

#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif
#define _CRTDBG_MAP_ALLOC
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif

decodeBase::decodeBase(QObject *parent) :
    QThread(parent), d(new videoDecodePrivate)
{
}

void decodeBase::setCodecContext(AVCodecContext *cc)
{
    d->cc = cc;
}

void decodeBase::setIoQueue(ioQueue *queue)
{
    d->queue = queue;
}

void decodeBase::setStreamIndex(int index)
{
    d->streamIndex = index;
}

void decodeBase::stopDecode()
{
    if(d->isExit)
        return;

    d->isExit = true;

    while (this->isRunning()) {
        QThread::msleep(30);
    }
}

decodeBase::~decodeBase()
{
    stopDecode();
	delete d;
}

